#include "fileserver.h"
#include "database.h"
#include "filethread.h"

FileServer::FileServer(QObject *parent) :
    QTcpServer(parent)
{

}

bool FileServer::startListening(int port) {
    return listen(QHostAddress::LocalHost, port);
}

void FileServer::incomingConnection(int socket) {
    qDebug()<<"new connection "<<socket;
    FileThread *thread = new FileThread(socket);
    //connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
    thread->start();
    //connection=server->nextPendingConnection();
    //connect(connection, SIGNAL(readyRead()),this, SLOT(read()));
}
